package cn.itcast.service.company.impl;

import cn.itcast.dao.company.CompanyDao;
import cn.itcast.domain.company.Company;
import cn.itcast.service.CompanyService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.UUID;

//此处实现的是dubbo提供的接口
@Service(timeout = 100000)
public class CompanyServiceImpl implements CompanyService {
    @Autowired
    private CompanyDao companyDao;
    @Override
    public List<Company> findAll() {
        return companyDao.findAll();
    }

    @Override
    public void save(Company company) {
        company.setId(UUID.randomUUID().toString());
   companyDao.save(company);
    }

    @Override
    public Company findId(String id) {
        return companyDao.findId(id);
    }

    @Override
    public void update(Company company) {
        companyDao.update(company);

    }

    @Override
    public void delete(String id) {
          companyDao.delete(id);
    }
}
